Type Inference and Principal Typings for Symmetric Record Concatenation and Mixin Modules
نویسندگان
چکیده
The obvious simple type system for a λ-calculus extended with recordconcatenation has a typability problem that was believed to be expensive,and which we prove NP-complete. Some previous approaches to this prob-lem employ subtyping polymorphism. We present Bowtie, a system of simpletypes for record concatenation which has principal typings, no subtyping, anda clean separation between unification-based type inference with type androw variables and constraint solving for safety of concatenation and fieldselection. Because Bowtie has no subtyping, we succeeded in straightfor-wardly generalizing it to a similar type system, Martini, for mixin modules.The type inference complexity for both systems is O(n), or O(n) given abounded number of field labels. We have implemented type inference forboth type systems. Because they have principal typings, extending eitherwith Milner’s let-polymorphism is straightforward.
منابع مشابه
Designing Record Systems
We explore the design space for type systems with poly-morphic records. We design record systems for extension , concatenation and removal of elds. Furthermore, we design a record system where eld labels become rst class values. That means, we can now quantify over eld lables and pass them around as arguments. All designed record systems enjoy type inference with principal types. Especially, we...
متن کاملType Inference for Record Concatenation and Multiple Inheritance
We show that the type inference problem for a lambda calculus with records, including a record concatenation operator, is decidable. We show that this calculus does not have principal types, but does have nite complete sets of types: that is, for any termM in the calculus, there exists an e ectively generable nite set of type schemes such that every typing for M is an instance of one the scheme...
متن کاملML Has Principal Typings
Is there a type system for core-ML that, using exactly the same syntax of types of the Damas-Milner system, types exactly the same terms of this system, and has principal typings? In this article we answer this question affirmatively. A definition of principal typing is given, capturing the simple idea of representing the set of all typings that can be obtained in derivations for a given term i...
متن کاملPrincipality and type inference for intersection types using expansion variables
Principality of typings is the property that for each typable term, there is a typing from which all other typings are obtained via some set of operations. Type inference is the problem of finding a typing for a given term, if possible. We define an intersection type system which has principal typings and types exactly the strongly normalizable λ-terms. More interestingly, every finite-rank res...
متن کاملWhat Are Principal Typings and What Are They Good For? Technical Memorandum Mittlcsstmm532
We demonstrate the pragmatic value of the principal typing property, a property more general than ML's principal type property, by studying a type system with principal typings. The type system is based on rank 2 intersection types and is closely related to ML. Its principal typing property provides elegant support for separate compilation, including \smartest recompilation" and incremental typ...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 2005